package com.codi.bus.core.service.model;

import com.codi.base.util.DateUtils;
import com.codi.base.util.StringUtil;
import com.codi.bus.constant.GlobalConstant;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by Shangdu Lin on 2017/6/12 14:39.
 * update by zx 2018年1月26日15:45:11
 */
@Data
public class DividendModel {

    /**
     * 交易账号
     */
    private String tradeAccount;

    public String getTradeAccount() {
        return tradeAccount;
    }

    public void setTradeAccount(String tradeAccount) {
        this.tradeAccount = tradeAccount;
    }

    /**
     * TA账号
     */
    private String taAccount;

    public String getTaAccount() {
        return taAccount;
    }

    public void setTaAccount(String taAccount) {
        this.taAccount = taAccount;
    }

    /**
     * 基金代码
     */
    private String fundCode;

    public String getFundCode() {
        return fundCode;
    }

    public void setFundCode(String fundCode) {
        this.fundCode = fundCode;
    }

    /**
     * 红利总金额
     */
    private BigDecimal totalDividendBalance;

    public BigDecimal getTotalDividendBalance() {
        return totalDividendBalance;
    }

    public void setTotalDividendBalance(BigDecimal totalDividendBalance) {
        this.totalDividendBalance = totalDividendBalance;
    }

    /**
     * 红利实发金额
     */
    private BigDecimal dividendBalance;

    /**
     * 权益登记日
     */
    private String equityRegDate;

    public String getEquityRegDateString() {
        if (!StringUtil.isEmpty(equityRegDate)) {
            Date date = DateUtils.stringToDate(equityRegDate, GlobalConstant.DATE_FORMAT_YYYYMMDD);
            return DateUtils.dateToSimpleStr(date);
        }
        return this.equityRegDate;
    }

    /**
     * 分红日
     */
    private String dividendDate;

    public String getdividendDateString() {
        if (!StringUtil.isEmpty(dividendDate)) {
            Date date = DateUtils.stringToDate(dividendDate, GlobalConstant.DATE_FORMAT_YYYYMMDD);
            return DateUtils.dateToSimpleStr(date);
        }
        return this.dividendDate;
    }

    /**
     * 分红方式
     */
    private String autoBuy;

    public String getAutoBuyString() {
        if ("0".equals(autoBuy)) {
            return "红利再投资";
        } else {
            return "现金分红";
        }
    }

    /**
     * 银行编号
     */
    private String bangNo;

    /**
     * 银行卡号
     */
    private String bankAccount;

    /**
     * 银行名称
     */
    private String bankName;

    /**
     * 基金名称
     */
    private String fundName;

    /**
     * 确认状态
     */
    private String status;

    /**
     * 确认日期
     */
    private String affirmDate;

    public String getaffirmDateString() {
        if (!StringUtil.isEmpty(affirmDate)) {
            Date date = DateUtils.stringToDate(affirmDate, GlobalConstant.DATE_FORMAT_YYYYMMDD);
            return DateUtils.dateToSimpleStr(date);
        }
        return this.affirmDate;
    }

    /**
     * 红股份额
     */
    private BigDecimal dividendShare;

    /**
     * ta 编号
     */
    private String taSerialId;

    /**
     * 冻结金额
     */
    private BigDecimal frozenBala;

    /**
     * 冻结份额
     */
    private BigDecimal frozenShares;

    /**
     * 净值
     */
    private BigDecimal netValue;

    /**
     * 每股分红股数
     */
    private BigDecimal unitShare;
    /**
     * 每股分红金额
     */
    private BigDecimal unitBala;

}
